//
//  MovieModel.m
//  噗嗤
//
//  Created by cjp on 16/8/12.
//  Copyright © 2016年 cjp. All rights reserved.
//

#import "MovieModel.h"


@implementation MovieModel

// 成员变量
{
    CGFloat _cellHeight;
    CGRect _pictureF;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    
}

- (CGFloat)cellHeight{
    if (!_cellHeight) {
        // 文字的最大尺寸
        CGSize maxSize = CGSizeMake([UIScreen mainScreen].bounds.size.width - 2 * MovieCellMargin, MAXFLOAT);
        // 计算文字的高度
        MovieModel *model = [MovieModel new];
        CGFloat titleH = [model.title boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size.height;
        
        // 文字部分的高度
        _cellHeight = MovieCellTextY + titleH + MovieCellMargin;
        
        // 图片高度
        _cellHeight += pictureH;
        
        // 底部工具条的高度
        _cellHeight += MovieCellBottonBarH + MovieCellMargin;
    }
    
    return _cellHeight;
}

@end
